<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <title>所有电影</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="/static/lib/css/bootstrap.min.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
    <div class="row">
        <ul class="nav nav-pills">
            <li class="active">
                <a href="#">首页</a>
            </li>
            <li><a href="#">电影</a></li>
            <li><a href="#">影院</a></li>
        </ul>
    </div>
    <div class="row">
        <form class="form-search" style="float: right">
            <input type="text" class="input-medium search-query">
            <a class="btn">搜索</a>
            <!--<a class="btn btn-success" href="/static/html/movie/addMovie.html">添加</a>-->
            <button data-target="#addMovieModal" type="button" class="btn btn-success" data-toggle="modal">添加
            </button>
        </form>
    </div>
    <div class="row">
        <table id="movies" class="table table-striped table-bordered table-hover text-center">
            <thead>
            <tr>
                <th>电影名称</th>
                <th>电影导演</th>
                <th>上映时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tr v-for="movie of movies">
                <td>{{movie.name}}</td>
                <td>{{movie.director}}</td>
                <td>{{movie.date | dataFormate}}</td>
                <td>
                    <button @click="edit(movie)" class="btn">编辑</button>
                    <button @click="deleteMovie(movie.id)" class="btn btn-danger">删除</button>
                </td>
            </tr>
        </table>
    </div>

    <div id="addMovieModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="addMovieLabel"
         aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="addMovieLabel">添加电影</h3>
        </div>
        <div class="modal-body">
            <div id="addMovie">
                <div class="form-horizontal">
                    <div class="control-group">
                        <div class="control-label">
                            <label for="name">电影名：</label>
                        </div>
                        <div class="controls">
                            <input id="name" type="text" class="input-xlarge" placeholder="电影名" v-model="movie.name">
                        </div>
                    </div>
                    <div class="control-group">
                        <div class="control-label">
                            <label for="director">导演：</label>
                        </div>
                        <div class="controls">
                            <input id="director" type="text" class="input-xlarge" placeholder="导演" v-model="movie.director">
                        </div>
                    </div>
                    <!--<div class="control-group">
                        <div class="controls">
                            <button class="btn btn-primary" @click.stop="addMovie()">增加</button>
                            <button type="reset" class="btn">重置</button>
                        </div>
                    </div>-->
                </div>
                <div v-if="message" class="alert" :class="classObject">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    <strong>{{message}}</strong>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
            <button class="btn btn-primary" @click.stop="addMovie()">保存</button>
        </div>
    </div>

    <div id="editMovieModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="editMovieLabel"
         aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="editMovieLabel">修改电影</h3>
        </div>
        <div class="modal-body">
            <div id="editMovie">
                <div class="form-horizontal">
                    <div class="control-group">
                        <div class="control-label">
                            <label for="editname">电影名：</label>
                        </div>
                        <div class="controls">
                            <input id="editname" type="text" class="input-xlarge" placeholder="电影名" v-model="movie.name">
                        </div>
                    </div>
                    <div class="control-group">
                        <div class="control-label">
                            <label for="editdirector">导演：</label>
                        </div>
                        <div class="controls">
                            <input id="editdirector" type="text" class="input-xlarge" placeholder="导演" v-model="movie.director">
                        </div>
                    </div>
                    <!--<div class="control-group">
                        <div class="controls">
                            <button class="btn btn-primary" @click.stop="addMovie()">增加</button>
                            <button type="reset" class="btn">重置</button>
                        </div>
                    </div>-->
                </div>
                <div v-if="message" class="alert" :class="classObject">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    <strong>{{message}}</strong>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
            <button class="btn btn-primary" @click="editMovie()">保存</button>
        </div>
    </div>
</div>

</body>
<script type="text/javascript" src="/static/lib/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/lib/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/lib/js/vue.min.js"></script>
<script type="text/javascript" src="/static/lib/js/vue-resource.min.js"></script>
<script type="text/javascript" src="/static/js/movie/movies.js"></script>
</html>